<?php

class Ext_View_Helper_SmartyTemplate extends Zend_View_Helper_Abstract
{

    public function smartyTemplate( $template, $data )
    {
        $smarty = Ext_Smarty::getInstance();
        
        $ret = json_decode( $data, true );
        
        if ( is_array( $ret ) && ! empty( $template ) ) {
            $smarty->assign( $ret );
            return $smarty->fetch( $template );
        }
        return $data;
    }
}
